<?php
namespace Home\Controller;
use Think\Controller;
class IndexController extends Controller {
    public function indexAction(){
    	$openid=I('openid');
		$id=I('id');
	if($openid){
 		 $where['openid']=$openid;
 		 $re=M('user')->where($where)->find();
 	} 	
 	if($id){
 		 $where['id']=$id;
 		 $re=M('user')->where($where)->find();
 	} 
	 
	  $this->assign('list',$re);
      $this->display();
		  
	
    }
	public function userlistAction(){
    		$id=I('id');
			$re=M('user')->where("id=".$id)->find();
			
			$this->assign('list',$re);
			
		    $this->display();
	
    }
	public function adduserAction(){
    		$id=I('id');
			$data=array('name'=>I('name'),'tel'=>I('tel'));
			$re=M('user')->where("id=".$id)->save($data);
			$this->redirect('Index/index',array('id' =>$id));
			
		   
    }
	public function useracticleAction(){
    		$id=I('id');
			$re=M('acticle')->where("uid=".$id)->select();
		
			$this->assign('list',$re);
      		$this->display();
			
			
		   
    }
		public function acticleAction(){
    		$id=I('id');
			$re=M('acticle')->where("id=".$id)->find();	
			
			$this->assign('list',$re);
      		$this->display();
			
			
		   
    }
}